import store from "@/stores";
import { defineStore } from "pinia";
import { ref } from 'vue'

export const useUserStore = defineStore('user_supplier', () => {
  // 用户信息
  const user = ref({})
  // 设置用户，登录后使用
  const setUserInfo = (data) => {
    user.value = { ...data }
  }
  // 清除用户数据
  const clearUserInfo = () => {
    user.value = {}
  }
  return { user, setUserInfo, clearUserInfo }
}, {
  persist: true
});

export function useUserStoreHook() {
  return useUserStore(store);
}
